package 代码记录.指定公司代码练习记录.西安.分值100分;

import java.util.Scanner;

/**
 * @author zx
 * @create 2023-07-03 22:28
 * 牛客上找的答案，csdn是错的，还没来得及看
 */
public class 喊7的次数重排 {//17---copy
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String[] arr = str.split(" ");
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += Integer.parseInt(arr[i]);
        }
        int[] res = new int[arr.length];
        int count = 0;
        int n = 0;
        for(;;) {
            n++;
            String temp = n + "";
            if (n % 7 == 0 || temp.contains("7")) {
                count++;
            }
            if (count == sum) {
                break;
            }
        }
        for (int i = 1; i <= n; i++) {
            if (i % 7 == 0 || (i + "").contains("7")) {
                res[(i - 1) % arr.length] = res[(i - 1) % arr.length] + 1;
            }
        }
        for (int i = 0;i < res.length;i++) {
            System.out.print(res[i] + " ");
        }
    }
}